﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace 徐汉权
{
    public partial class Register : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            var usersname = TextBox1.Text.TrimEnd();
            var pwd = TextBox2.Text.TrimEnd();
            var sqlsel = string.Format("select Username,Password from Users where Username = '{0}' and Pssword='{1}'",usersname,pwd);
            var sqlint = string.Format("select * from Users where Username = '{0}'", usersname);
            Dbepr.dataTable(sqlint);
            if (usersname != sqlint)

            {
                if (pwd == TextBox3.Text.TrimEnd())
                {
                    //ok
                    Dbepr.OrUpdataOrDelete(sqlsel);
                    Response.Write("注册成功");
                }
                else 
                {
                    Response.Write("两次密码输入不一致");
                }
            }
            else 
            {
                Response.Write("该用户已存在");
            }
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            Response.Redirect("Login.aspx");
        }
    }
}